const Router = require('koa-router')
const router = new Router()
const koaBody = require('koa-bodyparser');

const history = require('../model/history');
router.post('/gethistory', koaBody(), async (ctx, next) => {
    const username = ctx.request.body.username;
    const userhistory = await history.GETHISTORY(username);
    ctx.body = userhistory;
    

})

router.post('/addhistory', koaBody(), async (ctx, next) => {
    const username = ctx.request.body.username;
    const addhistory = ctx.request.body.addhistory;
    const userhistory = await history.ADDHISTORY(username,addhistory);
    ctx.body = userhistory;
})



module.exports = router;
    
